package com.hoshiicloud.common.feign;

import com.hoshiicloud.common.rpc.Response;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author ygd
 * @title: BaseFeignService
 * @projectName hoshiicloud
 * @description: BaseFeignService
 * @date 2019/9/16
 */
public interface BaseFeignService<T> {

    @GetMapping("/queryAll")
    Response<List<T>> queryAll();

    @PostMapping(value = "/queryList")
    Response<List<T>> queryList(@RequestBody T entity);

    @GetMapping("/queryById")
    Response<T> queryById(@RequestParam("id") Object id);

    @PostMapping("/create")
    Response<Integer> create(@RequestBody T entity);

    @PostMapping("/createBatch")
    Response<Integer> createBatch(@RequestBody List<T> list);

    @PostMapping("/updateAll")
    Response<Integer> updateAll(@RequestBody T entity);

    @PostMapping("/updateNotNull")
    Response<Integer> updateNotNull(@RequestBody T entity);

    @PostMapping("/delete")
    Response<Integer> delete(@RequestBody T entity);

    @PostMapping("/deleteById")
    Response<Integer> deleteById(@RequestBody Object id);

    @PostMapping("/count")
    Response<Integer> count(@RequestBody T entity);


}
